#!/bin/bash
set -eu

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework

setupenvironment

readonly LOW_LIMIT=$(( 2 * 1024 * 1024 ))

buildpackage 'simple-package'
buildpackage 'simple-package-noarch'
buildpackage 'conflicting-package-one'
buildpackage 'conflicting-package-two'

generaterepository_and_switch_sources "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS"

testregexmatch \
	"(.*
)*Reading Package Lists\.\.\.
Building Dependency Tree\.\.\.
W: pkgMakeStatusCache: The configured APT::Cache-Limit \($LOW_LIMIT\) is below the recommended default value \([0-9]*\)\. Remove it to use the default\.
W: You may want to run apt-get update to correct these problems" \
	aptget update -o APT::Cache-Limit="$LOW_LIMIT"
testsuccess aptcache show simple-package
testsuccess aptcache show simple-package-noarch
testfailure aptcache show nosuchpkg
